#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

vector<int> exchange(vector<int>& nums) {
    int n = nums.size();
    vector<int> res(n);
    int left = 0, right = n - 1;
    for (int i = 0; i < n; i++)
    {
        if (nums[i] % 2)
            res[left++] = nums[i];
        else
            res[right--] = nums[i];
    }
    return res;
}